package main

import "fmt"

type People struct {
	Time string
}

func (p People) Info() {
	fmt.Println("people ", p.Time)
}

type Student struct {
	People
	Name string
	Age  int
}

func (s Student) PrintInfo() {
	fmt.Printf("name:%s age:%d\n", s.Name, s.Age)
}
func (s Student) Info() {
	fmt.Println("Student ", s.Time)
}

func main() {
	p := People{
		Time: "2023-11-15 14:51",
	}
	s := Student{
		People: p,
		Name:   "枫枫",
		Age:    21,
	}
	s.Name = "枫枫知道" // 修改值
	s.PrintInfo()
	s.Info()                   // 可以调用父结构体的方法
	fmt.Println(s.People.Time) // 调用父结构体的属性
	fmt.Println(s.Time)        // 也可以这样
}
